package cn.hebutlf.userService.controller;


import cn.hebutlf.commonUtils.Result;
import cn.hebutlf.userService.entity.Users;
import cn.hebutlf.userService.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xbfinal
 * @since 2023-08-05
 */
@RestController
@RequestMapping("/userService/users")
public class UsersController {

    private final UsersService usersService;

    public UsersController(UsersService usersService) {
        this.usersService = usersService;
    }

    /**
     * 查看所有用户数量
     */
    @GetMapping("find/allUser")
    public Result findAllUser(){
        return usersService.findAllUser();
    }

    /**
     * 添加用户
     */
    @PostMapping("add/user")
    public Result addUser(Users users){
        usersService.save(users);
        return Result.ok();
    }





}

